package org.yhtch.util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import org.yhtch.jswtdic.res.R;

public class DicEditTool {
	public static void show() {
		try {
			Scanner in = new Scanner(new GZIPInputStream(new FileInputStream(R
					.getR().getDicFilePath())), "UTF-8");
			while (in.hasNextLine())
				System.out.println(in.nextLine());
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void create() {
		try {
			PrintStream out = new PrintStream(new GZIPOutputStream(
					new FileOutputStream(R.getR().getDicFilePath())), false,
					"UTF-8");
			//out.println("jdic\t}(}(本程序");
			out.println(",./\t测试解释测试解释");
			out.flush();
			out.close();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		//create();
		show();
	}
}
